package com.data.modules.online.cgform.service.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.*;

import com.data.common.system.util.BootDataAutorUtils;
import com.data.modules.online.auth.service.IOnlAuthDataService;
import com.data.modules.online.auth.service.IOnlAuthPageService;
import com.data.modules.online.cgform.entity.OnlCgformField;
import com.data.modules.online.cgform.entity.OnlCgformHead;
import com.data.modules.online.cgform.mapper.OnlCgformFieldMapper;
import com.data.modules.online.cgform.mapper.OnlCgformHeadMapper;
import com.data.modules.online.cgform.model.SqlOrder;
import com.data.modules.online.cgform.model.TreeModel;
import com.data.modules.online.cgform.constant.LinkDown;
import com.data.modules.online.cgform.extend.ExtendJsonKey;
import com.data.modules.online.cgform.util.CgformUtil;
import com.data.modules.online.config.executor.ConditionHandler;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import com.data.common.system.api.ISysBaseAPI;
import com.data.common.system.vo.LoginUser;
import com.data.common.util.ConvertUtils;
import com.data.modules.online.cgform.mapper.OnlineMapper;
import com.data.modules.online.cgform.service.IOnlCgformFieldService;
import com.data.modules.online.cgreport.util.CgReportSqlUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

@SuppressWarnings("ALL")
@Slf4j
@Service
public class OnlCgformFieldServiceImpl extends ServiceImpl<OnlCgformFieldMapper, OnlCgformField> implements IOnlCgformFieldService {

    private static final Logger f211a = LoggerFactory.getLogger(OnlCgformFieldServiceImpl.class);

    private static final String f212b = "0";
    @Autowired
    private OnlCgformHeadMapper cgformHeadMapper;
    @Autowired
    @Lazy(true)
    private IOnlAuthDataService onlAuthDataService;
    @Autowired
    @Lazy(true)
    private IOnlAuthPageService onlAuthPageService;
    @Autowired
    private OnlCgformFieldMapper onlCgformFieldMapper;
    @Autowired
    private OnlineMapper onlineMapper;
    @Autowired
    private ISysBaseAPI sysBaseAPI;

    private static /* synthetic */ java.lang.Object m149a(java.lang.invoke.SerializedLambda r4) {
        /*
        // Method dump skipped, instructions count: 2622
        */
        throw new UnsupportedOperationException("Method not decompiled: com.data.modules.online.cgform.service.p013a.OnlCgformFieldServiceImpl.m149a(java.lang.invoke.SerializedLambda):java.lang.Object");
    }

    @Override
    public Map<String, Object> queryAutolistPage(OnlCgformHead head, Map<String, Object> params, List<String> needList) {
        String tableName = head.getTableName();
        String id = head.getId();
        HashMap var6 = new HashMap();
        LambdaQueryWrapper<OnlCgformField> query = new LambdaQueryWrapper<OnlCgformField>();
        query.eq(OnlCgformField::getCgformHeadId, id);
        query.orderByAsc(OnlCgformField::getOrderNum);
        List list = this.list(query);
        List fieldList = this.queryAvailableFields(id, tableName, true, list, needList);
        StringBuffer sql = new StringBuffer();
        CgformUtil.m245a(tableName, fieldList, sql);
        LoginUser loginUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
        String userid = loginUser.getId();
        List authList = this.onlAuthDataService.queryUserOnlineAuthData(userid, id);
        if (authList != null && authList.size() > 0) {
            BootDataAutorUtils.installUserInfo(this.sysBaseAPI.getCacheUser(loginUser.getUsername()));
        }

        ConditionHandler conditionHandler = new ConditionHandler("t.");
        conditionHandler.setNeedList(needList);
        conditionHandler.setSubTableStr(head.getSubTableStr());
        List var15 = CgformUtil.m287g(list);
        String var16 = conditionHandler.mo1321a(var15, params, authList);
        Map sqlParam = conditionHandler.getSqlParams();
        if (var16.trim().length() > 0) {
            sql.append(" t ").append(" where  ").append(var16);
        }

        String var18 = this.m150a(list, params);
        sql.append(var18);
        Integer var19 = params.get("pageSize") == null ? 10 : Integer.parseInt(params.get("pageSize").toString());
        if (var19 == -521) {
            List var20 = this.onlineMapper.selectByCondition(sql.toString(), sqlParam);
            if (var20 != null && var20.size() != 0) {
                var6.put("total", var20.size());
                var6.put("fieldList", fieldList);
                var6.put("records", CgformUtil.m280d(var20));
            } else {
                var6.put("total", 0);
                var6.put("fieldList", fieldList);
            }
        } else {
            Integer var23 = params.get("pageNo") == null ? 1 : Integer.parseInt(params.get("pageNo").toString());
            Page var21 = new Page((long)var23, (long)var19);
            IPage var22 = this.onlineMapper.selectPageByCondition(var21, sql.toString(), sqlParam);
            var6.put("total", var22.getTotal());
            var6.put("records", CgformUtil.m280d(var22.getRecords()));
        }

        return var6;
    }

@Override
public java.util.Map<java.lang.String, java.lang.Object> queryAutoTreeNoPage(java.lang.String r15, java.lang.String r16, java.util.Map<java.lang.String, java.lang.Object> r17, java.util.List<java.lang.String> r18, java.lang.String r19) {
        /*
        // Method dump skipped, instructions count: 442
        */
        throw new UnsupportedOperationException("Method not decompiled: com.data.modules.online.cgform.service.p013a.OnlCgformFieldServiceImpl.queryAutoTreeNoPage(java.lang.String, java.lang.String, java.util.Map, java.util.List, java.lang.String):java.util.Map");
    }

private java.util.Map<java.lang.String, java.lang.Object> m154a(java.lang.String r8, java.lang.String r9, java.lang.String r10, java.util.List<java.lang.String> r11, java.lang.String r12) {
        /*
        // Method dump skipped, instructions count: 229
        */
        throw new UnsupportedOperationException("Method not decompiled: com.data.modules.online.cgform.service.p013a.OnlCgformFieldServiceImpl.m154a(java.lang.String, java.lang.String, java.lang.String, java.util.List, java.lang.String):java.util.Map");
    }

    @Override
    public void saveFormData(String code, String tbname, JSONObject json, boolean isCrazy) {
        LambdaQueryWrapper<OnlCgformField> var5 = new LambdaQueryWrapper<OnlCgformField>();
        var5.eq(OnlCgformField::getCgformHeadId, code);
        List var6 = this.list(var5);
        if (isCrazy) {
            ((OnlCgformFieldMapper)this.baseMapper).executeInsertSQL(CgformUtil.m272c(tbname, var6, json));
        } else {
            ((OnlCgformFieldMapper)this.baseMapper).executeInsertSQL(CgformUtil.m241a(tbname, var6, json));
        }

    }

    @Override
    public void saveTreeFormData(String code, String tbname, JSONObject json, String hasChildField, String pidField) {
        LambdaQueryWrapper<OnlCgformField> var6 = new LambdaQueryWrapper();
        var6.eq(OnlCgformField::getCgformHeadId, code);
        List var7 = this.list(var6);
        Iterator var8 = var7.iterator();

        while(true) {
            while(var8.hasNext()) {
                OnlCgformField var9 = (OnlCgformField)var8.next();
                if (hasChildField.equals(var9.getDbFieldName()) && var9.getIsShowForm() != 1) {
                    var9.setIsShowForm(1);
                    json.put(hasChildField, "0");
                } else if (pidField.equals(var9.getDbFieldName()) && ConvertUtils.isEmpty(json.get(pidField))) {
                    var9.setIsShowForm(1);
                    json.put(pidField, "0");
                }
            }

            Map var10 = CgformUtil.m241a(tbname, var7, json);
            ((OnlCgformFieldMapper)this.baseMapper).executeInsertSQL(var10);
            if (!"0".equals(json.getString(pidField))) {
                ((OnlCgformFieldMapper)this.baseMapper).editFormData("update " + tbname + " set " + hasChildField + " = '1' where id = '" + json.getString(pidField) + "'");
            }

            return;
        }
    }

    @Override
    public void saveFormData(List<OnlCgformField> fieldList, String tbname, JSONObject json) {
        this.onlCgformFieldMapper.executeInsertSQL(CgformUtil.m241a(tbname, fieldList, json));
    }

    @Override
    public void editFormData(String code, String tbname, JSONObject json, boolean isCrazy) {
        LambdaQueryWrapper<OnlCgformField> var5 = new LambdaQueryWrapper<OnlCgformField>();
        var5.eq(OnlCgformField::getCgformHeadId, code);
        List var6 = this.list(var5);
        if (isCrazy) {
            this.onlCgformFieldMapper.executeUpdatetSQL(CgformUtil.m281d(tbname, var6, json));
        } else {

            this.onlCgformFieldMapper.executeUpdatetSQL(CgformUtil.b(tbname, var6, json));
        }

    }

@Override
public void editTreeFormData(String code, String tbname, JSONObject json, String hasChildField, String pidField) {
        String var6 = CgformUtil.m285f(tbname);
        String var7 = "select * from " + var6 + " where id = '" + json.getString("id") + "'";
        Map var8 = ((OnlCgformFieldMapper)this.baseMapper).queryFormData(var7);
        Map var9 = CgformUtil.m242a(var8);
        String var10 = var9.get(pidField).toString();
        LambdaQueryWrapper<OnlCgformField> var11 = new LambdaQueryWrapper<OnlCgformField>();
        var11.eq(OnlCgformField::getCgformHeadId, code);
        List var12 = this.list(var11);
        Iterator var13 = var12.iterator();

        while(var13.hasNext()) {
            OnlCgformField var14 = (OnlCgformField)var13.next();
            if (pidField.equals(var14.getDbFieldName()) && ConvertUtils.isEmpty(json.get(pidField))) {
                var14.setIsShowForm(1);
                json.put(pidField, "0");
            }
        }

        Map var16 = CgformUtil.m241a(tbname, var12, json);
        ((OnlCgformFieldMapper)this.baseMapper).executeUpdatetSQL(var16);
        if (!var10.equals(json.getString(pidField))) {
            if (!"0".equals(var10)) {
                String var17 = "select count(*) from " + var6 + " where " + pidField + " = '" + var10 + "'";
                Integer var15 = ((OnlCgformFieldMapper)this.baseMapper).queryCountBySql(var17);
                if (var15 == null || var15 == 0) {
                    ((OnlCgformFieldMapper)this.baseMapper).editFormData("update " + var6 + " set " + hasChildField + " = '0' where id = '" + var10 + "'");
                }
            }

            if (!"0".equals(json.getString(pidField))) {
                ((OnlCgformFieldMapper)this.baseMapper).editFormData("update " + var6 + " set " + hasChildField + " = '1' where id = '" + json.getString(pidField) + "'");
            }
        }

    }

@Override
    public Map<String, Object> queryFormData(String code, String tbname, String id) {
        LambdaQueryWrapper<OnlCgformField> var4 = new LambdaQueryWrapper<OnlCgformField>();
        var4.eq(OnlCgformField::getCgformHeadId, code);
        var4.eq(OnlCgformField::getIsShowForm, 1);
        List var5 = this.list(var4);

        String var6 = CgformUtil.m229a(tbname, var5, id);
        return this.onlCgformFieldMapper.queryFormData(var6);
    }


@Override
    @org.springframework.transaction.annotation.Transactional(rollbackFor = {java.lang.Exception.class})
public void deleteAutoListMainAndSub(OnlCgformHead r19, java.lang.String r20) {
        /*
        // Method dump skipped, instructions count: 392
        */
        throw new UnsupportedOperationException("Method not decompiled: com.data.modules.online.cgform.service.p013a.OnlCgformFieldServiceImpl.deleteAutoListMainAndSub(org.jeecg.modules.online.cgform.entity.OnlCgformHead, java.lang.String):void");
    }

    @Override
    public void deleteAutoListById(String tbname, String ids) {
        deleteAutoList(tbname, "id", ids);
    }

    @Override
    public void deleteAutoList(String tbname, String linkField, String linkValue) {
        if (!(linkValue == null || "".equals(linkValue))) {
            String[] split = linkValue.split(CgformUtil.f231E);
            StringBuffer stringBuffer = new StringBuffer();
            for (String str : split) {
                if (str != null && !"".equals(str)) {
                    stringBuffer.append(CgformUtil.f229C + str + "',");
                }
            }
            String stringBuffer2 = stringBuffer.toString();
            this.onlCgformFieldMapper.deleteAutoList("DELETE FROM " + CgformUtil.m285f(tbname) + CgReportSqlUtil.f390a + linkField + " in(" + stringBuffer2.substring(0, stringBuffer2.length() - 1) + ")");
        }
    }


@Override
    public List<Map<String, String>> getAutoListQueryInfo(String code) {
        byte var2 = 0;
        OnlCgformHead var3 = (OnlCgformHead)this.cgformHeadMapper.selectOne((Wrapper)(new LambdaQueryWrapper<OnlCgformHead>()).eq(OnlCgformHead::getId, code));
        ArrayList var4 = new ArrayList();
        boolean var5 = CgformUtil.m258a(var3);
        int var14 = this.a(var3, var4, var2, var5);
        Integer var6 = var3.getTableType();
        if (var5 && var6 != null && 2 == var6) {
            String var7 = var3.getSubTableStr();
            if (var7 != null && !"".equals(var7)) {
                String[] var8 = var7.split(",");
                String[] var9 = var8;
                int var10 = var8.length;

                for(int var11 = 0; var11 < var10; ++var11) {
                    String var12 = var9[var11];
                    OnlCgformHead var13 = (OnlCgformHead)this.cgformHeadMapper.selectOne((Wrapper)(new LambdaQueryWrapper<OnlCgformHead>()).eq(OnlCgformHead::getTableName, var12));
                    if (var13 != null) {
                        var14 = this.a(var13, var4, var14, true);
                    }
                }
            }
        }

        return var4;
    }

    public List<OnlCgformField> queryFormFields(String code, boolean isform) {
        LambdaQueryWrapper<OnlCgformField> var3 = new LambdaQueryWrapper<OnlCgformField>();
        var3.eq(OnlCgformField::getCgformHeadId, code);
        if (isform) {
            var3.eq(OnlCgformField::getIsShowForm, 1);
        }

        return this.list(var3);
    }


@Override
public java.util.List<OnlCgformField> queryFormFieldsByTableName(java.lang.String r4) {
        /*
            r3 = this;
            org.jeecg.modules.online.cgform.mapper.OnlCgformHeadMapper r1 = r3.cgformHeadMapper
            com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper r0 = new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
            void r2 = r0.<init>()
            java.lang.Object r0 = r0.eq(r2, r4)
            com.baomidou.mybatisplus.core.conditions.Wrapper r0 = (com.baomidou.mybatisplus.core.conditions.Wrapper) r0
            java.lang.Object r0 = r1.selectOne(r0)
            org.jeecg.modules.online.cgform.entity.OnlCgformHead r0 = (org.jeecg.modules.online.cgform.entity.OnlCgformHead) r0
            if (r0 == 0) goto L_0x002e
            com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper r1 = new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
            void r2 = r1.<init>()
            java.lang.String r0 = r0.getId()
            r1.eq(r2, r0)
            java.util.List r0 = r3.list(r1)
        L_0x002d:
            return r0
        L_0x002e:
            r0 = 0
            goto L_0x002d
        */
        throw new UnsupportedOperationException("Method not decompiled: com.data.modules.online.cgform.service.p013a.OnlCgformFieldServiceImpl.queryFormFieldsByTableName(java.lang.String):java.util.List");
    }


@Override
public OnlCgformField queryFormFieldByTableNameAndField(java.lang.String r4, java.lang.String r5) {
        /*
            r3 = this;
            org.jeecg.modules.online.cgform.mapper.OnlCgformHeadMapper r1 = r3.cgformHeadMapper
            com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper r0 = new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
            void r2 = r0.<init>()
            java.lang.Object r0 = r0.eq(r2, r4)
            com.baomidou.mybatisplus.core.conditions.Wrapper r0 = (com.baomidou.mybatisplus.core.conditions.Wrapper) r0
            java.lang.Object r0 = r1.selectOne(r0)
            org.jeecg.modules.online.cgform.entity.OnlCgformHead r0 = (org.jeecg.modules.online.cgform.entity.OnlCgformHead) r0
            if (r0 == 0) goto L_0x004c
            com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper r1 = new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
            void r2 = r1.<init>()
            java.lang.String r0 = r0.getId()
            java.lang.Object r0 = r1.eq(r2, r0)
            r1.eq(r0, r5)
            java.util.List r0 = r3.list(r1)
            if (r0 == 0) goto L_0x004c
            java.util.List r0 = r3.list(r1)
            int r0 = r0.size()
            if (r0 <= 0) goto L_0x004c
            java.util.List r0 = r3.list(r1)
            r1 = 0
            java.lang.Object r0 = r0.get(r1)
            org.jeecg.modules.online.cgform.entity.OnlCgformField r0 = (org.jeecg.modules.online.cgform.entity.OnlCgformField) r0
        L_0x004b:
            return r0
        L_0x004c:
            r0 = 0
            goto L_0x004b
        */
        throw new UnsupportedOperationException("Method not decompiled: com.data.modules.online.cgform.service.p013a.OnlCgformFieldServiceImpl.queryFormFieldByTableNameAndField(java.lang.String, java.lang.String):org.jeecg.modules.online.cgform.entity.OnlCgformField");
    }

    @Override
    public Map<String, Object> queryFormData(List<OnlCgformField> fieldList, String tbname, String id) {
        return this.onlCgformFieldMapper.queryFormData(CgformUtil.m229a(tbname, fieldList, id));
    }

    @Override
    public List<Map<String, Object>> querySubFormData(List<OnlCgformField> fieldList, String tbname, String linkField, String value) {
        return this.onlCgformFieldMapper.queryListData(CgformUtil.m230a(tbname, fieldList, linkField, value));
    }

    @Override
    public IPage<Map<String, Object>> selectPageBySql(Page<Map<String, Object>> page, String sql) {
        return this.baseMapper.selectPageBySql(page, sql);
    }

    @Override
    public List<String> selectOnlineHideColumns(String tbname) {
        return m152a(this.baseMapper.selectOnlineHideColumns(((LoginUser) SecurityUtils.getSubject().getPrincipal()).getId(), "online:" + tbname + ":%"));
    }

    @Override
    public List<OnlCgformField> queryAvailableFields(String cgFormId, String tbname, String taskId, boolean isList) {
        LambdaQueryWrapper<OnlCgformField> var5 = new LambdaQueryWrapper<OnlCgformField>();
        var5.eq(OnlCgformField::getCgformHeadId, cgFormId);
        if (isList) {
            var5.eq(OnlCgformField::getIsShowList, 1);
        } else {
            var5.eq(OnlCgformField::getIsShowForm, 1);
        }

        var5.orderByAsc(OnlCgformField::getOrderNum);
        List var6 = this.list(var5);
        String var7 = "online:" + tbname + "%";
        LoginUser var8 = (LoginUser)SecurityUtils.getSubject().getPrincipal();
        String var9 = var8.getId();
        ArrayList var10 = new ArrayList();
        List var11;
        if (ConvertUtils.isEmpty(taskId)) {
            var11 = this.onlAuthPageService.queryHideCode(var9, cgFormId, isList);
            if (var11 != null && var11.size() != 0 && var11.get(0) != null) {
                var10.addAll(var11);
            }
        } else if (ConvertUtils.isNotEmpty(taskId)) {
            var11 = ((OnlCgformFieldMapper)this.baseMapper).selectFlowAuthColumns(tbname, taskId, "1");
            if (var11 != null && var11.size() > 0 && var11.get(0) != null) {
                var10.addAll(var11);
            }
        }

        if (var10.size() == 0) {
            return var6;
        } else {
            ArrayList var14 = new ArrayList();

            for(int var12 = 0; var12 < var6.size(); ++var12) {
                OnlCgformField var13 = (OnlCgformField)var6.get(var12);
                if (this.m155b(var13.getDbFieldName(), var10)) {
                    var14.add(var13);
                }
            }

            return var14;
        }
    }

    @Override
    public List<String> queryDisabledFields(String tbname) {
        return m152a(this.baseMapper.selectOnlineDisabledColumns(((LoginUser) SecurityUtils.getSubject().getPrincipal()).getId(), "online:" + tbname + "%"));
    }

    @Override
    public List<String> queryDisabledFields(String tbname, String taskId) {
        if (ConvertUtils.isEmpty(taskId)) {
            return null;
        }
        return m152a(this.baseMapper.selectFlowAuthColumns(tbname, taskId, "2"));
    }

    private List<String> m152a(List<String> list) {
        ArrayList arrayList = new ArrayList();
        if (list == null || list.size() == 0 || list.get(0) == null) {
            return arrayList;
        }
        for (String str : list) {
            if (!ConvertUtils.isEmpty(str)) {
                String substring = str.substring(str.lastIndexOf(":") + 1);
                if (!ConvertUtils.isEmpty(substring)) {
                    arrayList.add(substring);
                }
            }
        }
        return arrayList;
    }

    @Override
    public List<OnlCgformField> queryAvailableFields(String tbname, boolean isList, List<OnlCgformField> List, List<String> needList) {
        return m153a(this.baseMapper.selectOnlineHideColumns(((LoginUser) SecurityUtils.getSubject().getPrincipal()).getId(), "online:" + tbname + "%"), isList, List, needList);
    }

    @Override
    public List<OnlCgformField> queryAvailableFields(String cgformId, String tbname, boolean isList, List<OnlCgformField> List, List<String> needList) {
        return m153a(this.onlAuthPageService.queryListHideColumn(((LoginUser) SecurityUtils.getSubject().getPrincipal()).getId(), cgformId), isList, List, needList);
    }

    private List<OnlCgformField> m153a(List<String> list, boolean z, List<OnlCgformField> list2, List<String> list3) {
        ArrayList arrayList = new ArrayList();
        boolean z2 = list != null && list.size() != 0 && list.get(0) != null;
        for (OnlCgformField onlCgformField : list2) {
            String dbFieldName = onlCgformField.getDbFieldName();
            if (list3 == null || !list3.contains(dbFieldName)) {
                if (z) {
                    if (onlCgformField.getIsShowList().intValue() != 1) {
                        if (ConvertUtils.isNotEmpty(onlCgformField.getMainTable()) && ConvertUtils.isNotEmpty(onlCgformField.getMainField())) {
                            arrayList.add(onlCgformField);
                        }
                    }
                } else if (onlCgformField.getIsShowForm().intValue() != 1) {
                }
                if (!z2) {
                    arrayList.add(onlCgformField);
                } else if (m155b(dbFieldName, list)) {
                    arrayList.add(onlCgformField);
                }
            } else {
                onlCgformField.setIsQuery(1);
                arrayList.add(onlCgformField);
            }
        }
        return arrayList;
    }

    private boolean m155b(String str, List<String> list) {
        boolean z = true;
        for (int i = 0; i < list.size(); i++) {
            String str2 = list.get(i);
            if (!ConvertUtils.isEmpty(str2)) {
                String substring = str2.substring(str2.lastIndexOf(":") + 1);
                if (!ConvertUtils.isEmpty(substring) && substring.equals(str)) {
                    z = false;
                }
            }
        }
        return z;
    }

    public boolean mo1001a(String str, List<OnlCgformField> list) {
        for (OnlCgformField onlCgformField : list) {
            if (ConvertUtils.camelToUnderline(str).equals(onlCgformField.getDbFieldName())) {
                return true;
            }
        }
        return false;
    }

    @Override
    public void executeInsertSQL(Map<String, Object> params) {
        this.baseMapper.executeInsertSQL(params);
    }

    @Override
    public void executeUpdatetSQL(Map<String, Object> params) {
        this.baseMapper.executeUpdatetSQL(params);
    }

    @Override
    public List<TreeModel> queryDataListByLinkDown(LinkDown linkDown) {
        return this.baseMapper.queryDataListByLinkDown(linkDown);
    }

    @Override
    public void updateTreeNodeNoChild(String tableName, String filed, String id) {
        this.baseMapper.executeUpdatetSQL(CgformUtil.m240a(tableName, filed, id));
    }

    @Override
    public String queryTreeChildIds(OnlCgformHead head, String ids) {
        String treeParentIdField = head.getTreeParentIdField();
        String tableName = head.getTableName();
        String[] split = ids.split(CgformUtil.f231E);
        StringBuffer stringBuffer = new StringBuffer();
        for (String str : split) {
            if (str != null && !stringBuffer.toString().contains(str)) {
                if (stringBuffer.toString().length() > 0) {
                    stringBuffer.append(CgformUtil.f231E);
                }
                stringBuffer.append(str);
                m151a(str, treeParentIdField, tableName, stringBuffer);
            }
        }
        return stringBuffer.toString();
    }

    @Override
    public String queryTreePids(OnlCgformHead head, String ids) {
        String treeParentIdField = head.getTreeParentIdField();
        String tableName = head.getTableName();
        StringBuffer stringBuffer = new StringBuffer();
        String[] split = ids.split(CgformUtil.f231E);
        for (String str : split) {
            if (str != null) {
                String obj = CgformUtil.m242a(this.baseMapper.queryFormData("select * from " + CgformUtil.m285f(tableName) + " where id = '" + str + CgformUtil.f229C)).get(treeParentIdField).toString();
                List<Map<String, Object>> queryListBySql = this.onlCgformFieldMapper.queryListBySql("select * from " + CgformUtil.m285f(tableName) + CgReportSqlUtil.f390a + treeParentIdField + "= '" + obj + "' and id not in(" + ids + ")");
                if ((queryListBySql == null || queryListBySql.size() == 0) && !Arrays.asList(split).contains(obj) && !stringBuffer.toString().contains(obj)) {
                    stringBuffer.append(obj).append(CgformUtil.f231E);
                }
            }
        }
        return stringBuffer.toString();
    }

@Override
public java.lang.String queryForeignKey(java.lang.String r3, java.lang.String r4) {
        /*
            r2 = this;
            com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper r0 = new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
            void r1 = r0.<init>()
            java.lang.Object r1 = r0.eq(r1, r3)
            r0.eq(r1, r4)
            java.util.List r0 = r2.list(r0)
            if (r0 == 0) goto L_0x002b
            int r1 = r0.size()
            if (r1 <= 0) goto L_0x002b
            r1 = 0
            java.lang.Object r0 = r0.get(r1)
            org.jeecg.modules.online.cgform.entity.OnlCgformField r0 = (org.jeecg.modules.online.cgform.entity.OnlCgformField) r0
            java.lang.String r0 = r0.getMainField()
        L_0x002a:
            return r0
        L_0x002b:
            r0 = 0
            goto L_0x002a
        */
        throw new UnsupportedOperationException("Method not decompiled: com.data.modules.online.cgform.service.p013a.OnlCgformFieldServiceImpl.queryForeignKey(java.lang.String, java.lang.String):java.lang.String");
    }

    @Override
    public List<Map<String, Object>> queryListBySql(String sql) {
        return this.onlCgformFieldMapper.queryListBySql(sql);
    }

    @Override
    public IPage<Map<String, Object>> selectPageBySql(String sql, int pageNo, int pageSize) {
        return this.onlCgformFieldMapper.selectPageBySql(new Page<>((long) pageNo, (long) pageSize), sql);
    }

    private StringBuffer m151a(String str, String str2, String str3, StringBuffer stringBuffer) {
        List<Map<String, Object>> queryListBySql = this.onlCgformFieldMapper.queryListBySql("select * from " + CgformUtil.m285f(str3) + CgReportSqlUtil.f390a + str2 + "= '" + str + CgformUtil.f229C);
        if (queryListBySql != null && queryListBySql.size() > 0) {
            for (Map<String, Object> map : queryListBySql) {
                Map<String, Object> a = CgformUtil.m242a(map);
                if (!stringBuffer.toString().contains(a.get("id").toString())) {
                    stringBuffer.append(CgformUtil.f231E).append(a.get("id"));
                }
                m151a(a.get("id").toString(), str2, str3, stringBuffer);
            }
        }
        return stringBuffer;
    }

    private String m150a(List<OnlCgformField> list, Map<String, Object> map) {
        String string;
        Object obj = map.get("column");
        ArrayList<SqlOrder> arrayList = new ArrayList();
        if (obj == null || "id".equals(obj.toString())) {
            for (OnlCgformField onlCgformField : list) {
                if ("1".equals(onlCgformField.getSortFlag())) {
                    String fieldExtendJson = onlCgformField.getFieldExtendJson();
                    SqlOrder eVar = new SqlOrder(onlCgformField.getDbFieldName());
                    if (fieldExtendJson != null && !"".equals(fieldExtendJson) && (string = JSON.parseObject(fieldExtendJson).getString(ExtendJsonKey.f93g)) != null && !"".equals(string)) {
                        eVar.setRule(string);
                    }
                    arrayList.add(eVar);
                }
            }
            if (arrayList.size() == 0) {
                arrayList.add(SqlOrder.m144a());
            }
        } else {
            String obj2 = obj.toString();
            Object obj3 = map.get("order");
            String str = "desc";
            if (obj3 != null) {
                str = obj3.toString();
            }
            arrayList.add(new SqlOrder(obj2, str));
        }
        ArrayList arrayList2 = new ArrayList();
        for (SqlOrder eVar2 : arrayList) {
            if (mo1001a(eVar2.getColumn(), list)) {
                arrayList2.add(eVar2.getRealSql());
            }
        }
        return " ORDER BY " + String.join(CgformUtil.f231E, arrayList2);
    }

    private int a(OnlCgformHead var1, List<Map<String, String>> var2, int var3, boolean var4) {
        LambdaQueryWrapper<OnlCgformField> var5 = new LambdaQueryWrapper<OnlCgformField>();
        var5.eq(OnlCgformField::getCgformHeadId, var1.getId());
        var5.eq(OnlCgformField::getIsQuery, 1);
        var5.orderByAsc(OnlCgformField::getOrderNum);
        List var6 = this.list(var5);

        HashMap var9;
        for(Iterator var7 = var6.iterator(); var7.hasNext(); var2.add(var9)) {
            OnlCgformField var8 = (OnlCgformField)var7.next();
            var9 = new HashMap();
            var9.put("label", var8.getDbFieldTxt());
            if (var4) {
                var9.put("field", var1.getTableName() + "@" + var8.getDbFieldName());
            } else {
                var9.put("field", var8.getDbFieldName());
            }

            var9.put("dbField", var8.getDbFieldName());
            var9.put("mode", var8.getQueryMode());
            String var10 = var8.getQueryConfigFlag();
            String var11;
            String[] var12;
            String var13;
            if ("1".equals(var10)) {
                var11 = var8.getQueryShowType();
                var9.put("config", "1");
                var9.put("view", var11);
                var9.put("defValue", var8.getQueryDefVal());
                if ("cat_tree".equals(var11)) {
                    var9.put("pcode", var8.getQueryDictField());
                } else if ("sel_tree".equals(var11)) {
                    var12 = var8.getQueryDictText().split(",");
                    var13 = var8.getQueryDictTable() + "," + var12[2] + "," + var12[0];
                    var9.put("dict", var13);
                    var9.put("pidField", var12[1]);
                    var9.put("hasChildField", var12[3]);
                    var9.put("pidValue", var8.getQueryDictField());
                } else {
                    var9.put("dictTable", var8.getQueryDictTable());
                    var9.put("dictCode", var8.getQueryDictField());
                    var9.put("dictText", var8.getQueryDictText());
                }
            } else {
                var11 = var8.getFieldShowType();
                var9.put("view", var11);
                var9.put("mode", var8.getQueryMode());
                if ("cat_tree".equals(var11)) {
                    var9.put("pcode", var8.getDictField());
                } else if ("sel_tree".equals(var11)) {
                    var12 = var8.getDictText().split(",");
                    var13 = var8.getDictTable() + "," + var12[2] + "," + var12[0];
                    var9.put("dict", var13);
                    var9.put("pidField", var12[1]);
                    var9.put("hasChildField", var12[3]);
                    var9.put("pidValue", var8.getDictField());
                } else {
                    var9.put("dictTable", var8.getDictTable());
                    var9.put("dictCode", var8.getDictField());
                    var9.put("dictText", var8.getDictText());
                }
            }

            ++var3;
            if (var3 > 2) {
                var9.put("hidden", "1");
            }
        }

        return var3;
    }
}
